Scheduling heterogenous computation on multithreaded processors

ABSTRACT

Aspects include computation systems that can identify computation instances that are not capable of being reentrant, or are not reentrant capable on a target architecture, or are non-reentrant as a result of having a memory conflict in a particular execution situation. A system can have a plurality of computation units, each with an independently schedulable SIMD vector. Computation instances can be defined by a program module, and a data element(s) that may be stored in a local cache for a particular computation unit. Each local cache does not maintain coherency controls for such data elements. During scheduling, a scheduler can maintain a list of running (or runnable) instances, and attempt to schedule new computation instances by determining whether any new computation instance conflicts with a running instance and responsively defer scheduling. Memory conflict checks can be conditioned on a flag or other indication of the potential for non-reentrancy.

CROSS REFERENCE TO RELATED APPLICATIONS

This application claims priority from U.S. provisional application No. 61/497,915, entitled “Non-Blocking Concurrent Computation Architectures”, filed Jun. 16, 2011, and from U.S. provisional application No. 61/515,824, entitled “Heterogeneous Concurrent Computation”, filed Aug. 5, 2011, all of which is incorporated by reference in their entirety for all purposes herein.

BACKGROUND

1. Field

The following relates to approaches to scheduling computation in multithreaded processors or groupings thereof, and in a more particular aspect, to scheduling for graphics processors with clusters of SIMD computation units.

2. Related Art

Parallel computation paradigms present theoretical possibilities to continue acceleration of processing computation workloads. However, taking full advantage of parallel processing is challenging. Approaches to increased parallelism that present a comparatively low burden on programmers (such as SIMD processors) can increase parallelism to some extent, and work better on some workloads than others. Other approaches to parallelism, such as multithreading require more intensive coding practices, and present other overhead, such as context switching logic.

Examples of workloads than benefit from further development of approaches to parallel processing comprise graphics processing, and in a more particular example, ray tracing of 3-D scenes to render high quality 2-D images, such as photo-realistic 2-D images. Ray tracing is known to produce photo-realistic images, including realistic shadow and lighting effects, because ray tracing can model the physical behavior of light interacting with elements of a scene. Ray tracing usually involves obtaining a scene description composed of geometric shapes, which describe surfaces of structures in the scene, and can be called primitives. A common primitive shape is a triangle. Objects can be composed of one or more such primitives. Objects each can be composed of many thousands, or even millions (or more) of such primitives. Scenes typically contain many objects, leading to scenes of tens or hundreds of millions of primitives. Resolution of displays and the media to be displayed thereon continue to increase. Ray tracing requires repeating a few calculations many times with different data (e.g. intersection testing), as well as executing special purpose code (“shading”) for identified ray intersections.

SUMMARY

In one aspect, a system for performing graphics computation has a plurality of clusters of computation units. Each computation unit has a plurality of ALUs and a working memory used by the ALUs during execution of tasks on the ALUs. The system also has a distributor of computation tasks among the ALUs. The distributor is coupled to read tasks from a queue of tasks, and is operable to assign the tasks for execution on the plurality of clusters. The assigning comprises, for each of the clusters, determining which locations of each working memory are referenced by non-reentrant tasks currently scheduled for execution in that cluster, and dispatching non-reentrant tasks for execution by a identified cluster with a working memory that has a location referenced by the task, and which is currently not being referenced by any non-reentrant task executing on that cluster. The distributor can be implemented by logic elements associated with respective clusters, each of which determine non-reentrancy for instances that are to be executed on its cluster. Such determination can account for current execution status of other instances on that cluster. The distributor can include a plurality of input buffers for the clusters. The input buffers are operable to store descriptions of non-reentrant tasks to be scheduled on a respective cluster awaiting completion of execution of a conflicting non-reentrant task on that cluster.

In an aspect, a system comprises a plurality of clusters, each cluster comprising a plurality of ALUs and a memory used by the ALUs as working memory during execution of tasks on the ALUs. In one example, each ALU of each cluster comprises a Single Instruction Multiple Data (SIMD) execution unit having a vector width, and the local scheduler for each cluster is operable to switch among different streams of instructions to be scheduled for execution on the cluster, on a cycle by cycle basis.

In some aspects, the system is operable to flag tasks as re-entrant or non-reentrant, and a local scheduler for each cluster is operable to condition the detecting of conflicting tasks on a flag associated with a received task, so that only non-reentrant tasks are checked for conflict by the local scheduler.

In some aspects, methods of task scheduling include receiving specifications for computation tasks to be performed in a cluster of computation units, maintaining a list of tasks that have been scheduled to execute in the cluster. The list comprises information indicating whether any of the tasks on the list are non-reentrant. The methods also include scheduling tasks to be executed from among the tasks specified by the received specifications. The scheduling includes deferring scheduling of any task, among the tasks specified by the received specifications, that is non-reentrant and has a capability to write to a memory location shared by any non-reentrant task on the list of tasks.

Articles of manufacture can be made to implement these aspects. Such articles comprise integrated circuitry capable of being programmed to render computer graphics images. Such integrated circuitry includes clusters, each comprising a plurality of ALUs and a cache. Circuitry for implementing a scheduler for scheduling computation tasks on the cluster, from a list of available tasks is also provided. The tasks are reentrant tasks and non-reentrant tasks. The non-reentrant tasks include an indication of at least one location in the cache that can be written by that task during execution. The scheduler is operable, for each non-reentrant task to be scheduled, to compare the respective indicated location in the cache with the indicated locations of each non-reentrant task in the list of tasks, and to add only non-reentrant tasks that have indicated cache locations that do not conflict with indicated locations of non-reentrant tasks in the list of tasks.

Other aspects include a graphics computation system. The system comprises a plurality of clusters, each comprising a plurality of ALUs and a memory used by the ALUs as working memory during execution of tasks on the ALUs. A global scheduler is operable to enqueue packets indicating processing to be conducted on the clusters, each packet identifying a program module and a groups of data elements to be distributed among the clusters for use during execution of the program module. Respective schedulers are each operable to receive packets from the global scheduler, to maintain a set of threads for which resources of the cluster have been allocated, and to determine when program modules from received packets will be added to the set of threads. Such determining includes determining that one or more of the data elements provided from the global scheduler are not being accessed by any thread of the set of threads. Each scheduler operates to run the ALUs with instructions from a selected thread, using plural data elements received from multiple packets over a time period.

In some aspects, schedulers maintain respective lists of in-progress program instances and in response to completion of a program instance, attempt to schedule a replacement selected from among the received instances, the selecting comprising determining whether any received program instance that is non-reentrant has a conflicting memory access with any of the remaining in-progress program instances.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 depicts a situation where reentrancy of a program module is a consideration for correct execution;

FIG. 2 depicts an example architecture for a heterogeneous computation platform in which reentrant and non-reentrant computation instances can be executed;

FIG. 3 depicts a flow of dependent non-reentrant instances of computation which can be handled according to the disclosure;

FIG. 4 depicts an example of scheduling collections of computation instances on a computation cluster according to the disclosure;

FIG. 5 depicts aspects of an example cluster of arithmetic units;

FIG. 6 depicts an example of a scheduler for implementing serialization according to the disclosure;

FIG. 7 depicts an example serialization process;

FIG. 8 another example of a scheduling pool and scheduler;

FIG. 9 depicts another example serialization process;

FIG. 10 depicts further example aspects of a scheduler and related functionality for serialization;

FIG. 11 depicts a further example serialization process;

FIG. 12 depicts an approach for prioritizing scheduling of executing instances, responsive to conditions created during serialization;

FIG. 13 depicts further aspects of serialization according to the disclosure; and

FIG. 14 depicts further aspects of serialization according to the disclosure.

DETAILED DESCRIPTION

Parallelism is a design goal and concept that can be implemented at different levels of abstraction within a computation system, and consequently can refer to a panoply of disparate concepts. A high level perspective can focus on parallelism of entire software packages so that they can run concurrently on a given computer. Some amount of parallelism can be extracted at such level.

A finer-grained parallelism concerns how to better schedule smaller portions of computation to reduce wasted opportunities to perform useful computation. However, a primary concern is to produce a correct result. In some cases, a programmer has little idea what kind of computation architecture may be used to execute a particular portion of code (or may desire the code to be easily portable across a variety of architectures). Therefore, the programmer may follow a set of programming practices designed to provide a self-consistent output. For example, if a particular code module may be executed in a multithreaded system, then some variables manipulated by that code module may need to be protected by synchronization mechanisms, such as spinlocks, or mutexes. These kinds of safety mechanisms add overhead to a system both by requiring resources to implement them, but also can prevent execution of other code modules that would otherwise be available to be executed.

Computation architectures according to one aspect of this disclosure provide an approach wherein a relatively traditional multithreading programming model is available for tasks that effectively use that model, and a different programming model is available for other kinds of computation problems. Such other kinds of tasks involve situations where a large number of data elements need to be processed with a relatively small number of routines, that may have branching, conditions, or other computations, but which may have simpler control structure than a typical application expected to run on a general purpose processor. For these kinds of computation problems, an element of data (“a primary element”) may be used relatively persistently in processing more transient data elements. Thus, in one approach, tasks can be defined on a level that correlates to the duration of persistence of the primary element, and further defined on a level correlating to the duration of usage of secondary elements. As an example, in the context of ray tracing, a task of intersection testing a ray can be defined on a level correlating to completion of testing that ray, so that definition data for the ray corresponds to a primary element. When a particular shape is to be tested with that ray, a task can be further defined with a secondary element of that shape, and the ray.

FIG. 1 is used to set the context for aspects of the following disclosure. FIG. 1 depicts a processor execution context in which a non-reentrant program 103 has instructions 106-108. Instructions 106-108 can configure a processor 105 to execute operations specified by those instructions. Operations can include operations that require access to a memory space 107. A program 116 also includes instructions, for example instruction 120, that can be used to configure processor 105. In this example an operating system 112 controls scheduling of programs for execution in processor 105. Here program 103 is shown to be executing in processor 105. At instruction 107, non-reentrant program 103 attempts a jump to begin execution of instructions from program 116. A non-reentrant program however cannot allow return to execute instruction 108 after program 116 completes. As such FIG. 1 depicts an example characteristic of a non-reentrant program or section of code, which is that execution correctness cannot be guaranteed for a non-reentrant program if control is transferred to another program, even if control ultimately is returned to the non-reentrant program and all local state is saved. One issue for example is that non-reentrant program 103 may have been operating using a value stored in memory space 107, but program 116 may have modified those values (where memory locks or other memory protection mechanisms are not in use). A non-reentrant program would not be able to detect or correct that circumstance.

In some implementations, a sufficient condition to determine non-reentrancy for an instance is to determine whether that instance would produce conflicting memory accesses during execution. Such conflict can be between or among instances of that code module, or with instances of other code modules. In one example, a code module is analyzed to determine whether instances of that code module will need to be executed serially on a processor under certain conditions. For example, a particular type of code module may have circumstances in which instances will have conflicting memory accesses. Such conflicting memory access may not be ascertainable until particular instances of that code module are under consideration.

In some examples herein, a program module (which can be instantiated) are categorized according to whether a programmer, profiler or compiler considers that program module to require memory conflict checking. Herein, such program module is called non-reentrant, even though, in a particular execution circumstance, it may not pose a conflict with another executing instance.

In an example, a processing architecture provides a serialization mechanism by which execution correctness can be maintained. By providing a serialization mechanism for instances of non-reentrant code segments (modules), a variety of advantages and processing efficiency for heterogeneous multiprocessing can accrue. The following disclosure relates to examples of such architectures and how these architectures may behave.

FIG. 2 depicts an exemplary system architecture 202 in which disclosed aspects can be practiced. System 202 comprises a packet unit 205, which includes an empty stack 206, a local storage allocator 208, a ready stack 210, a collection definition memory 212, and a packet 214. Packet unit 205 can communicate with coarse scheduler 222, which can include a thread memory status module 220. Coarse scheduler also can contain a program segment profiler 221, which operates to profile program code in order to determine whether it has properties consistent with being non-reentrant. Profiler 221 can flag instances as being reentrant or non-reentrant, in some implementations (e.g, that such instances require memory conflict checks before execution).

Packet unit 205 collects groupings of instances of computation (generally, called instance(s)s for clarity) to be distributed among the plurality of compute clusters, which will perform work specified by the instances, as described below. Coarse scheduler 222 tracks usage of computation resources in the plurality of computation clusters, such as memory allocation and usage. In some implementations, an allocation of a portion of a local memory in a particular computation cluster is static and assigned when setting up the thread on that computation cluster. Coarse scheduler 222 also can allocate instances for execution in the clusters.

In one example, a thread executing on a particular cluster can instantiate a program or indicate a portion of a program to be executed (thereby making an instance). Coarse scheduler 222 can receive the information concerning the instance and allocate a particular cluster to execute the instance. As introduced above, allocation of a instance to execute on a cluster does not indicate that execution would commence immediately, but rather execution of such instance depends on scheduling within the cluster assigned.

An abstraction/distributor layer 225 separates a series of computation clusters (clusters 227 and 229 are depicted) from coarse scheduler 222 and from packet unit 205. Distributor layer 225 accepts groupings of instances from packet unit 205 and causes the instances to be distributed among the computation clusters, according to an exemplary approach described below.

Each cluster comprises a respective controller (controllers 230 and 232 depicted for cluster 227 and 229 respectively). Each cluster controller (e.g., 230 and 232) controls a plurality of arithmetic logic units (ALU) (e.g. cluster controller 230 controls a plurality of ALUs including ALU 235 and ALU 236). Each ALU of a cluster communicates with a local storage memory (e.g. local storage 240). In one implementation, each ALU has a separate and dedicated access path to local storage 240, such that each ALU can read or write concurrently from and to the memory with the other ALUs of that cluster. Memory resources of a given cluster further comprise a broadcasted data memory (e.g. broadcasted data memory 260 of cluster 227). In an example implementation, broadcasted data memory 260 can be implemented in the same physical storage medium as thread local storage 240. In an example, broadcast data memory 260 can be highly interleaved cache that allows a particular location of memory to map to a number of different locations in the broadcast data memory. In some implementations, broadcasted data memory may comprise a ring buffer or FIFO memory implementation. These broadcasted data memories are fed under control of a direct memory access unit (DMA) 241. In one example, implementations of DMA 241 control storage of data in a plurality of broadcasted data memories in a number of clusters. In other examples, such memory 260 can be implemented as a hardware managed cache, such as an LRU cache.

Each cluster comprises an input buffer, e.g. cluster 227 comprises input buffer 267, and cluster 229 has input buffer 269. Each input buffer for each cluster is written by distribution layer 225 and read by the respective controller of that cluster. For example, distribution layer 225 writes to input buffer 267 which is read by cluster controller 230. In view of the above introduction to the components of example system 202, aspects of the operation of this example system 202 are described below.

A collection grouping algorithm is executed by packet unit 205. The collection grouping algorithm operates to collect instances based on matching scheduling keys of respective instances. Additionally each instance can be associated with a respective priority, and in such case a representative priority of a collection of instances can be determined and used in an algorithm to select collections of instances to be executed on the array of clusters. Information identifying instances of selected collections subsequently is dispersed among clusters in the array, as explained below.

FIG. 3 depicts further aspects of declaration of computation instances, including declaration of storage allocated for instances of computation according to the computation model disclosed herein. FIG. 3 depicts collecting instances according to their scheduling keys. Aspects of FIG. 3 can be implemented within packet unit 205 (FIG. 2), for example.

In the example depicted in FIG. 3, a first instance, such as instance 360, results in allocation of declared storage 351. As computation time progresses, more and more instances may be recursively instantiated, which all reference storage 351. However, each of these instances typically would have a different scheduling key and therefore may be grouped with widely disparate other instances that reference different data elements in storage.

These concepts are depicted in FIG. 3 with declared storage 352 and 353 which each are referenced by a different lineage of instances. FIG. 3 further depicts that all the instances can be managed by collector 358 which forms collections. Collector 358 outputs collections for execution within the computation resources available. During such execution each instance may reference its respective data element, as depicted by the legend which indicates that read/write during execution may be repeated for all instances that descend from an initial instance that created a particular data element.

FIG. 3 thus depicts several examples of computing concepts. One example depicted a computing concept is that many instances depend or are otherwise recursively instantiated from an initial instance, which as shown in FIG. 3 can be created by a thread. By contrast with typical multithreading however each instance is not necessarily scheduled for execution, or even attempted to be scheduled immediately upon its being created. Instead, instances are collected, deferred and scheduled for execution according to a scheduling key. In the example of FIG. 3 scheduling can be accomplished by a centralized scheduling resource which ultimately distributes collections of instances determined to be ready for execution among a plurality of independently operable computation clusters. Regardless of a number of threads that descend from a particular thread each thread ultimately can access the same element of data. In one example, each computation instance that references a particular data element is made to execute serially on a single cluster of the array of clusters, or other available parallel computing resource. Further, because in many such examples each computation cluster can independently operate to switch among executing a plurality of threads or other computation instances, outputting a collection of instances from the collection point does not directly control when such instances are executed. Rather, as explained below, the instances of the collection are stored in an appropriate input buffer for a cluster in which those instances ultimately will be executed.

FIG. 4 continues from the example of FIG. 3; FIG. 4 depicts a stream of incoming groups of instances 432, a scheduling and work distribution abstraction 430 cause the instances of groups to be dispersed among a plurality of clusters. Dispersal, in the example of FIG. 4, comprises storing a reference to the instance and other data that will be described below within a respective local memory for each cluster, which is accessed by a scheduler for that cluster. In particular, an ALU cluster scheduler 420 reads from and maintains local memory 424, while ALU cluster scheduler 422 reads from and maintains local memory 426.

Each ALU cluster scheduler 420 422 controls which stream of instructions is executed on its respective cluster 416 418. Each cluster 416 418 has read and write access to a respective cache 410 412. Additionally, each ALU cluster 416 418 also has read access to a respective simple cache 411 and 413. One operative distinction between caches 410 and 412 with respect to counterpart simple caches 411, 413 is that the simple caches are expected to be overwritten frequently with different data and temporal locality among data accesses expected to be comparatively low. By contrast, caches 410 and 412 are expected to maintain temporal locality to a higher degree.

In the example of FIG. 4, a main memory hierarchy 405 feeds simple caches 411 and 412 responsive to direct memory access setup requests that can be generated by work distribution abstraction 430, for example. However caches 410 and 412 typically would be setup to store data elements that are specifically reserved for collectable computation instances, in addition to local thread storage. Therefore, these caches can be at least partially controlled by pre-allocation, and not based entirely upon instruction-specific memory reads.

FIG. 5 depicts an example structure for a cluster that can be used in the array of clusters depicted in FIG. 2, for example. FIG. 5 depicts that cluster controller 230 can maintain a plurality of work identifiers 272-275. Each work identifier can be used to reference a sequence of program instructions available from a memory. In some examples, a memory hierarchy (not separately depicted) can include an instruction cache where recently used instructions may be stored. Such instruction cache can implement a least recently used algorithm for example or a trace cache approach in which a sequence of instructions including branches is maintained within the cache. A trace cache approach may be more appropriate for a cluster in which the ALUs can perform speculative execution, e.g. where cluster controller can include a predictive mechanism for predicting whether branches will be taken or not.

References 285 are used to identify locations 241-244 in local storage 240 that are outputted to ALUs 234-237. Each workload identifier 272-275 also can be associated with a respective reference to simple cache 260. In some examples, this reference can be the same among multiple workload identifiers, but is not necessarily so. To begin execution, local scheduling output 270 can be used to index both local storage 240 and simple cache 260 in order to provide data to be used by ALUs 234-237.

Thus in the implementation depicted in FIG. 5, each ALU executes the same instruction in a given execution cycle. However, data provided for execution of that instruction may vary. Each ALU communicates status 291 to controller 230, such as instance completion information.

For example, such instance information can include information for new instances to be executed within the cluster. Other information that can be maintained between global scheduler and the cluster includes instance reference count information 272. In some examples, such instance reference count information can be maintained within the cluster on which related instances execute. One example implementation causes all related instances to be executed on a single cluster, and in such implementation reference counts can be maintained within that cluster for those related instances.

The example of FIG. 5 also shows that each ALU 234-237 maintains a port to cache 240. Cache 240 stores thread local data. Simple cache 260 can cache global variables. By example, cache 240 also includes a plurality of instance memory locations 241-244, which are operated on by different computation instances that operate from the same thread of control. Writeback 290 returns results or otherwise updates memory locations 241-244 (or potentially other locations in local storage 240).

FIG. 6 depicts a situation in which scheduler 420 is operable to read from a pool of schedulable program instances identified as scheduling pool 505. Scheduling pool 505 can include a list of program counters 506, each program counter can have a corresponding reference to local memory, and a flag 508 indicative of whether that program currently is executing or not. In the example depicted program counter 509 includes a reference to local memory 510. Program counter 511 includes a reference to local memory 512.

Scheduler 420 uses these inputs in performing a process according to the example scheduling process of FIG. 7. At 522, the process includes identifying schedulable instances. At 523, scheduled instances associated with local memory references are also identified. If there are no schedulable workloads that have a local memory reference, then at 531, workloads can be scheduled according to other criteria, such as a prioritization mechanism, such as a round-robin scheme or so on. At 525, for one or more scheduled workloads that have a local memory reference, it is determined whether any local memory reference from such schedulable workloads matches the memory reference of a running workload.

With respect to the situation depicted in FIG. 6, program counter 509 had memory reference 510. In turn program counter 511 had memory reference 512. Therefore, at 525, scheduler 420 can determine whether memory reference 510 matches memory reference 512. Here matching can include determining whether reference 510 and reference 512 are within a range of memory addresses, or that these references partially overlap. These are examples to show that matching here does not require an exact correspondence but instead identifies whether reference 510 indicates that the program identified beginning at program counter 509 would present a potential memory conflict with respect to the program of program counter 511. Other situations may present or require different matching criteria, so that these examples are not limiting.

At 533, if there was a match between a schedulable instance memory reference and a running instance memory reference, then the schedulable workload is excluded from instances to be scheduled for execution during this scheduling iteration. At 527, a determination is made whether local memory references of schedulable instances match. If there are such schedulable instances, then scheduler 420 selects one of those workloads to be scheduled at 535. As would be understood, the example of selecting one workload of a plurality of such workloads is an example of a process appropriate for a processor architecture where scheduler 420 is scheduling programs that may access a unitary memory space. For architectures that do not have a unitary memory space, e.g. where the architecture has some notion of protected memory spaces, than scheduling for those architectures can be handled by configuring determining steps 523 and 525 to indicate that such memory ranges would not have potential conflicts to begin with.

In one aspect, program counter 509 and program counter 511, can be updated as execution of such programs proceeds. For example, scheduling pool 505 can indicate a current program counter for the running program identified by program counter 511, while program counter 509 would indicate a first instruction of that program to be executed, because that program is not yet running In one implementation, scheduling pool 505 can be updated to remove reference 512 under a circumstance where that local memory access already has occurred. In other words, an architecture can support detection of that one or more memory transactions that could cause a memory consistency problem for other workloads have been completed, such that the tasks awaiting execution can begin execution.

In other implementations such memory references 510, 512 can be static and a characteristic of that instance of code to be executed that remains until such instance of code complete execution.

FIG. 8 depicts an alternate example of scheduling reentrant and non-reentrant code modules. In particular, FIG. 10 depicts scheduler 420 operable to read from scheduling pool 551 in which is stored information for several programs (instances of portions of code, kernels, or code segments, for example) identified by program counters 544-546. In FIG. 8, each program counter is associated with a reentrant flag. For example, program counter 544 is flagged as being reentrant, by contrast program counter 545 and program counter 546 are flagged as being non-reentrant. Reentrant flag can be implemented as a default such that only programs that deviate from the default are associated with flag. For example, non-reentrant can be a default such that program counter 545 and 546 would not be associated explicitly with a reentrant flag.

FIG. 9 depicts an exemplary process for scheduling workloads from scheduling pool 551. At 552, schedulable workloads are identified. At 554, a determination is made whether any schedulable workloads are flagged as being non-reentrant. If no schedulable workloads are flagged as being non-reentrant then, at 562, workloads can be scheduled without regard for the remaining aspects of the depicted process. For any schedule workloads that are flagged as non-reentrant, at 568, serialization indicators for those workloads are accessed. These serialization indicators can be generated by a compiler or pre-processor of a program module that will be instantiated during run time. Such serialization indicators can be provided in the program module.

In an example a serialization indicator can be provided as a bitmask in a register or other memory location associated with a workload (or group of workloads, in that workloads can share an indicator, if they have the same serialization criteria). The serialization indicator in order to explicitly serialize execution of instances of particular programs or portions of program code. Serialization indicators can identify a memory address range. At 578, it is determined whether such serialization indicators match to any running (e.g., partially executed) workloads. If so, then at 580 such workloads are excluded from schedulable workloads. At 586, if there are any schedulable workloads that have matching local memory references, then in an example, at 566, one such workload from among a set of workloads that have matching local memory references is selected for scheduling. At 562, other workloads can be scheduled according to a default or typical scheduling process. The example of selecting one workload is for a situation where a particular memory range of interest is not protected by other mechanisms. As such the concept of determining workloads that are to be serialized versus ones that can execute in parallel is handled by an appropriate definition of how local memory references or ranges of memory are compared or matched.

FIG. 10 depicts a scheduler 605 which comprises a map 604 of local memory for a cluster, a repository 606 of instances of computation to be scheduled, and a repository 608 of execution status information. Compute units 610 receive scheduling information from scheduler 605 and output execution status to repository 608. FIG. 10 thus depicts a situation where scheduler 605 operates in a partially decoupled or otherwise asynchronous manner to provide overall scheduling information to compute units and to receive execution status feedback used in scheduling, but is not involved in scheduling of specific functional units within a particular specific processor entity, such as scheduling specific floating-point instructions on a floating point unit. FIG. 10 depicts a compiler 603 that can communicate with a global task group collector. Compiler 603 can input program modules of which instances can be created, and can create serialization information based on profiling the code, or based on other information provided in the program code, and based on characteristics of compute units 610.

FIG. 11 depicts an example process of scheduling workloads according to the disclosure. At 614, it is determined whether a workload to be scheduled references a local memory for a compute unit. For example, in some implementations, there may be workloads that do not read from or write to any locally scoped memory location, but instead access only read-only memory. If such workload is being scheduled, then, in the example scheduling process of FIG. 11, such workload can be permitted (622) to be scheduled. With respect to ray tracing, for example, all intersection tests involving a ray against different shapes in a scene (each being an instance of computation or a task herein) can be queued for execution in a computation unit that has local read write access to closest detected intersection information for that ray. During testing, such closest detected intersection information would be updated responsive to detecting a closer intersection than previous detected intersections. To avoid conflicts to this memory location, only one instance that tests this ray is permitted to execute in that computation unit. A remainder of the computation unit can be filled with instances involving testing other rays for intersection.

More typically, workloads would access at least some local memory. Local memory can be divided into space available for use by workloads that are reentrant and space for workloads that are not reentrant. At 616, if a workload is referencing a non-reentrant memory range, a check (618) to identify a potential conflict for that memory range is performed. Without a conflict, at 622, scheduling of such workload can be permitted. At 620, under a circumstance where there is a conflict, scheduling of such workload can be denied or deferred.

These various examples show implementations of a computer architecture that can support a simple fast writable and readable memory, which can be used in some examples to store variables that may be updated a number of times, by a potentially large number of independently scheduled instances of computation. By contrast with memory coherence mechanisms such as locking, memories in the present disclosure can be protected by serializing execution of computation instances that may cause a memory conflict. As such, memory correctness is not handled as a memory coherence question, but rather is addressed as a computation scheduling problem. The disclosures relating to how to parcel a program into separately schedulable computation instances allow a granular scheduling approach to be taken, which in turn provides a pool of schedulable computation instances that can be relatively scheduled to maintain processor utilization even as the serialization activities provide a further scheduling constraint.

FIG. 12 depicts an example approach to scheduling computation instances that can be used with the processes and structures described herein. As described above, instances can be serialized as a mechanism to maintain memory correctness. In practice, a given schedulable computation unit may have several different lines of serialized computation instances (i.e., there may be multiple groups of computation instances where group members are to be serially executed with respect to each other. It is conceivable that different kinds of computation instances may have different dynamic behaviors, such that some groups of serialized computation instances may need to be treated differently at different times.

FIG. 12, as an example, depicts a list 622 of code modules that have been scheduled and for which instruction execution may already be in progress, as well as a group of schedulable workloads 624. The list of code modules scheduled and potentially in progress 622 can be a relatively short list of code modules from which an instruction scheduler can select instructions to be scheduled and allocated to specific computation functional units for execution. Scheduled workloads 624 can be a larger list of workloads, such as a list saved on a stack and available for execution at a greater delay by pulling such workload into list 622. Scheduling process can include, at 628, counting a number of references to a particular local data element among schedulable workloads 624. At 629, A decision concerning whether throughput is restricted instances associated with a particular location data element. If not, then the method can return to 628, and if so, then the method can continue to 630. Such decision 629 is an example of a decision whether action should be taken to expedite processing of certain instances.

Based on relative counts of such references, at 630, and execution priority of code modules that reference a particular data element can be adjusted. For example, at 632, if there is in list 622, a computation instance that a particular local data element that is also referenced by a number of computation instances in 624, that computation instance in list 622 may be given a larger allocation of computation resources in order to expedite its completion. For example, instructions for such computation instance may be executed more frequently than a fair allocation for a number of execution cycles. Thus, the existing scheduled instance can be completed more rapidly, so that a new computation instance that references such particular local data element can be scheduled (e.g., by addition to list 622, such that scheduler can begin to schedule instructions in that instance's instruction stream.

FIG. 13 depicts an example computation architecture in which workloads that are to be serialized according to the disclosure and workloads that do not require such serialization can be heterogeneously processed in execution units 708, 711, 714. FIG. 13 depicts a pool of computation tasks 701 that can include tasks ready to be executed or being executed (instructions for such tasks may have been executed). Scheduling status for such computation tasks are maintained and used as input to a grouping unit 702.

Grouping unit 702 outputs groupings of such computation tasks that are proposed groupings to be scheduled. Grouping unit 702 outputs such proposed groupings to a serialization checker 705. Serialization checker identifies for computation instances that require serialization, whether there are any dependencies that are to be addressed by serialization. As depicted in FIG. 16, these dependencies can be considered for particular instruction execution timeslots T1 through Tn. In some instances, e.g. T2-T4, scheduling opportunities may be entirely consumed by a particular thread, such as a thread that uses a wide SIMD vector, which is reentrant, or both. Thus serialization does not need to be considered. Otherwise serialization checker 705 ensures that each slot in each cycle time is occupied by a computation instance that will not interfere with other computation instances executing in that cycle time.

FIG. 14 depicts a further perspective on computer architectures wherein the serializer can co-schedule processing resources that have access to distinct memories. FIG. 14 depicts a source of candidate computation instances 720 to be scheduled for execution, and a list of scheduled computation instances 723. Serializer 726 operates to fill available computation slots for computation units 740 and 741. In an example computation unit 740 and 741 can execute a single thread of control on a vector of data values. FIG. 14 depicts a memory 717 and a memory 729. In an example, memories 717 and 729 have portions that are not to be concurrently accessed by multiple computation instances but such memories do not have memory protection capabilities, such that computation serialization according to the disclosure is implemented. For example, candidate instances provide a source for substitute instances 732, 735 and 738, in response to detecting a conflict during a runtime implementation of serialization. For example, during each execution cycle, serializer 726 can determine whether any of the instances to be executed during that execution cycle make conflicting access to a memory, and if so, serializer 726 can cause substitute instance(s) to be provided to be executed instead of the conflicting instances. Such a runtime example can be used where memory references may be not finally realized until certain dependencies or other calculations are performed. However, it is expected that serialization requirements will usually be clear before beginning to execute a particular instance, especially in situations where all arithmetic units of a cluster will be driven by the same control stream.

As would be apparent from the disclosure, some of the components and functionality disclosed may be implemented in hardware, software, firmware, or any combination thereof. If implemented in firmware and/or software, the functions may be stored as one or more instructions or code on a computer-readable medium, in one example, the media is non-transitory. Examples include a computer-readable medium encoded with a data structure and a computer-readable medium encoded with a computer program. Machine-readable media includes non-transitory machine readable media. Other kinds of media include transmission media. A non-transitory medium may be any tangible medium that can be accessed by a machine. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store desired program code in the form of instructions or data structures and that can be accessed by a machine.

Those of skill will also appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software in a computer-readable medium, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.

The description of the aspects and features is provided to enable any person skilled in the art to make and use the systems, apparatuses and perform the methods disclosed. Various modifications will be readily apparent to those skilled in the art, and the principles described in this document may be applied to other aspects without departing from the spirit or scope of the disclosure. Thus, the description is not intended to limit the claims. Rather, the claims are to be accorded a scope consistent with the principles and novel features disclosed herein.

The drawings include relative arrangements of structure and ordering of process components, solely as an aid in understanding the description. These relative arrangements and numbering is not an implicit disclosure of any specific limitation on ordering or arrangement of elements and steps in the claims. Process limitations may be interchanged sequentially without departing from the scope of the disclosure, and means-plus-function clauses in the claims are intended to cover the structures described as performing the recited function that include not only structural equivalents, but also equivalent structures.

Although a variety of examples and other information was used to explain aspects within the scope of the appended claims, no limitation of the claims should be implied based on particular features or arrangements in such examples, as one of ordinary skill would be able to use these examples to derive a wide variety of implementations. Further and although some subject matter may have been described in language specific to examples of structural features and/or method steps, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to these described features or acts. For example, such functionality can be distributed differently or performed in components other than, additional to, or less than, those identified herein. Rather, the described features and steps are disclosed as examples of components of systems and methods within the scope of the appended claims. 

1. A system for performing graphics computation, comprising: a plurality of clusters of computation units, each computation unit comprising a plurality of ALUs and a working memory used by the ALUs during execution of tasks on the ALUs; and a distributor of computation tasks among the clusters, the distributor coupled to read tasks requiring execution, and operable to assign the tasks for execution on the plurality of clusters, the assigning comprising, for each of the clusters, determining which locations of each working memory are referenced by non-reentrant tasks currently scheduled for execution in that cluster, and dispatching non-reentrant tasks for execution by an identified cluster with a working memory that has a location referenced by the task, but which is currently not being referenced by any non-reentrant task scheduled for execution on that cluster.
 2. The system of claim 1, wherein a scheduler assigns reentrant tasks for execution on a cluster based on availability of computation resources required during execution of each task.
 3. The system of claim 2, wherein a determination of availability of computation resources comprises determining whether a required portion of memory is available in a particular cluster.
 4. The system of claim 1, wherein the distributor comprises a plurality of input buffers for the clusters, the input buffers operable to store descriptions of non-reentrant tasks to be scheduled on a respective cluster awaiting completion of execution of a conflicting non-reentrant task on that cluster.
 5. The system of claim 4, wherein the distributor is implemented as logic elements associated with each respective cluster, such that each logic element is independently operable to read tasks from an associated input buffer, and to determine whether tasks read from the associated input buffer can begin execution on the cluster associated with that logic element.
 6. The system of claim 1, wherein the distributor is operable to read a task from an input buffer, and to determine whether the task is re-entrant or non-reentrant by comparing a memory location referenced by the task with a set of memory locations identified as containing data associated with non-reentrant tasks.
 7. The system of claim 1, wherein the system is operable to categorize a task as non-reentrant by comparing a memory location referenced by the task with a set of memory locations identified as containing data, stored in a shared memory, and which can be written by a set of tasks currently scheduled for execution.
 8. The system for performing graphics computation of claim 1, further comprising local schedulers for each cluster of the plurality of clusters of computation units, each local scheduler operable to fill available computation capacity of the ALUs by selecting from a list of tasks, comprising both re-entrant and non-reentrant tasks.
 9. The system for performing graphics computation of claim 8, wherein each ALU comprises a Single Instruction Multiple Data (SIMD) execution unit having a vector width, and the local scheduler is operable to switch among different streams of instructions to be scheduled for execution on the cluster, on a cycle by cycle basis.
 10. The system for performing graphics computation of claim 8, wherein the system is operable to flag tasks as re-entrant or non-reentrant, and the local scheduler for each cluster is operable to condition the detecting of conflicting tasks on a flag associated with a received task, so that only non-reentrant tasks are checked for conflict by the local scheduler.
 11. A machine-implemented method of computation task scheduling, comprising: receiving specifications for computation tasks to be executed in a cluster of computation units; maintaining a list of tasks that have been scheduled to execute in the cluster, the list comprising information indicating whether any of the tasks on the list are non-reentrant; and scheduling tasks to be executed from among the tasks specified by the received specifications, the scheduling comprising deferring scheduling of any task, among the tasks specified by the received specifications, that is non-reentrant and has a capability to write to a memory location shared by any non-reentrant task on the list of tasks.
 12. The machine-implemented method of claim 11, further comprising determining non-reentrancy of each task by inspecting a flag associated with a definition of the task.
 13. The machine-implemented method of claim 11, further comprising determining non-reentrancy of each task by profiling respective program code of which the task is an instance.
 14. The machine-implemented method of claim 11, further comprising determining non-reentrancy by detecting an overlap between a memory range indicated as being non-reentrant and a respective memory address accessed by each task.
 15. The machine-implemented method of claim 11, further comprising determining non-reentrancy by detecting an overlap between a memory address capable of being written by a task on the list of tasks, and a respective memory address accessed by task to be scheduled for execution.
 16. A graphics computation system, comprising: a plurality of clusters, each comprising a plurality of ALUs and a memory used by the ALUs as working memory during execution of tasks on the ALUs; a global scheduler operable to enqueue packets indicating processing to be conducted on the clusters, each packet identifying a program module and a groups of data elements to be distributed among the clusters for use during execution of the program module; and respective schedulers for the clusters, each operable to receive packets from the global scheduler, to maintain a set of threads for which resources of the cluster have been allocated, and determine when program modules from received packets will be added to the set of threads by determining one or more of the data elements provided from the global scheduler are not being accessed by any thread of the set of threads; wherein each scheduler operates to run the ALUs with instructions from a selected thread, using plural data elements received from multiple packets over a time period.
 17. The graphics computation system of claim 16, wherein the ALUs of each cluster function as a Single Instruction Multiple Data (SIMD) execution unit comprising an execution vector which can be scheduled on a cycle by cycle basis, and the scheduler for that cluster is operable to fill the execution vector with computation tasks to be executed that collectively do not reference conflicting memory address ranges.
 18. A graphics computation system, comprising: a computation unit capable of interleaved execution of instructions sourced from a plurality of program sources, each with a separate thread of control; a receiver of instances of computation to be executed on the computation unit, the receiver coupled to receive definitions of program instances; and a scheduler to maintain a list of inprogress program instances and in response to completion of a program instance, to attempt to schedule a replacement selected from among the received instances, the selecting comprising determining whether any received program instance that is non-reentrant has a conflicting memory access with any of the remaining inprogress program instances.
 19. The graphics computation system of claim 18, wherein a flag associated with the program instance indicates whether the program instance is non-reentrant.
 20. The graphics computation system of claim 18, wherein the scheduler is operable to treat all received program instances as non-entrant.
 21. The graphics computation system of claim 18, wherein the computation unit comprises a Single Instruction Multiple Data (SIMD) execution unit comprising an execution vector which can be scheduled on a cycle by cycle basis, and the scheduler is operable to fill the execution vector with inprogress program instances that reference the same thread of control and which do not collectively reference conflicting memory address ranges.
 22. The graphics computation system of claim 18, further comprising a non-transitory machine readable medium storing instructions for implementing a compiler that inspects program sources and generates information indicating whether instances of each program source are non-reentrant, for use by the scheduler during runtime scheduling. 